package model.ability;

import model.area_effect.SkillObject;
import model.core.GameScheduler;
import model.effects.Effect;
import model.entity.Entity;
import model.map.GameMap;
import model.map.MapPoint;

/**
 * This class creates the skill object defined by the
 * ability and places it on a game map.
 * @author Zachary
 */
public class StraightAheadAbilityHandler {
	private GameMap map;
	
	/**
	 * Constructor for StraightAheadAbilityHandler.
	 * @param map
	 */
	public StraightAheadAbilityHandler(GameMap map) {
		this.map = map;
	}

	/**
	 * Places the appropriate SkillObject on the game map.
	 * @param straightAheadAbility
	 * @param effect
	 * @param caster
	 * @param abilityPoint
	 */
	public void run(StraightAheadAbility straightAheadAbility, Effect effect,
			Entity caster, MapPoint originPoint, MapPoint placePoint) {
		String name = straightAheadAbility.getName();
		String graphicID = straightAheadAbility.getGraphicID();
		int duration = straightAheadAbility.getDuration();
			
		SkillObject mapObject = new SkillObject(name, graphicID, effect,
			caster, originPoint, placePoint);
		
		map.addSkillObjectToTile(mapObject, placePoint);
		
		GameScheduler.getInstance().registerOnce(mapObject, duration);
	}
}
